package com.benbi.shequapi.controller;

import com.benbi.shequapi.service.CommunityService;
import com.benbi.shequapi.utils.Result;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/community")
public class CommunityController {
    @Resource
    CommunityService communityService;

    @RequestMapping("/getAllCommunity")
    public Result getAllCommunity(){
        return communityService.getAllCommunity();
    }

    @RequestMapping("/getCommunity")
    public Result getCommunity(@RequestParam("cid")int cid){
        return communityService.getCommunityByCid(cid);
    }

    @RequestMapping("/getLiveCommunity")
    public Result getLiveCommunity(@RequestParam("r_pid")int pid){return communityService.getLiveCommunity(pid);}
}
